package tsou.cn.glidetest.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;
import java.util.Locale;

import tsou.cn.glidetest.R;
import tsou.cn.glidetest.Util.ImageLoadUtil;
import tsou.cn.glidetest.bean.ListBean;
import tsou.cn.glidetest.view.RoundProgressBar;


/**
 * Created by Administrator on 2017/11/13 0013.
 */

public class ListAdapter extends BaseQuickAdapter<ListBean, BaseViewHolder> {


    public ListAdapter(@Nullable List<ListBean> data) {
        super(R.layout.item_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ListBean item) {
        ImageLoadUtil.display((ImageView) helper.getView(R.id.iv_list_home_photo),
                (RoundProgressBar) helper.getView(R.id.round_progressbar), item.getImage());

        helper.setText(R.id.tv_list_home_title, item.getTitle());
        helper.setText(R.id.tv_list_home_source,
                String.format(Locale.getDefault(), mContext.getString(R.string.source), item.getSource()));

        helper.setText(R.id.tv_list_home_focus,
                String.format(Locale.getDefault(), "%d", item.getStar()));
        helper.setText(R.id.tv_list_home_comments,
                String.format(Locale.getDefault(), "%d", item.getEvn()));

    }

}
